<template>
  <div :style="{height:(reviewOpen)?'80vh':'65vh'}">
    <t-row :gutter="14">
      <t-col :span="6">
        <t-tag size="large" variant="light" theme="primary">历史大纲</t-tag>
        <t-divider style="font-size: 20px">基本信息</t-divider>
        <t-form :colon="true" labelWidth="160px">
          <t-row style="align-items: stretch;row-gap: 12px" :gutter="14">
            <t-col :span="6">
              <t-card class="step-card" size="small" title="基本信息">
                <t-form-item label="项目编号" name="projectNum">
                  {{ projectData.projectNum || '暂未分配' }}
                </t-form-item>
                <t-form-item label="项目名称" name="projectName">
                  {{ historyData.projectName }}
                </t-form-item>
                <t-form-item label="承担单位">
                  {{ projectData.declareDeptName }}
                </t-form-item>
                <t-form-item label="计划类别" name="projectCategory">
                  {{ projectData.projectCategory | filterByTree(projectCategoryOptions) }}

                </t-form-item>
                <t-form-item label="学科分类" name="subjectClassification">
                  {{ projectData.subjectClassification | filterByDict(dict.type.subject_classification) }}
                </t-form-item>

                <t-form-item label="项目类型" name="projectType">
                  {{ projectData.projectType | filterByDict(dict.type.project_type) }}
                </t-form-item>
                <t-form-item label="申报日期" name="declareDate">
                  {{ projectData.declareDate }}
                </t-form-item>
                <t-form-item label="编制日期">
                  {{ historyData.compileDate }}
                </t-form-item>
                <t-form-item label="项目开始时间" name="startDate">
                  {{ historyData.startDate }}
                </t-form-item>
                <t-form-item label="项目结束时间" name="endDate">
                  {{ historyData.endDate }}
                </t-form-item>
                <t-form-item label="关键词" name="keyWord">
                  {{ projectData.keyWord }}
                </t-form-item>
                <t-form-item label="建议经费总概算" name="adviceFunding">
                  {{ historyData.adviceFunding !== null ? historyData.adviceFunding : projectData.adviceFunding }}万元
                </t-form-item>
                <t-form-item :label="site_tag==='jtt'?'申请厅补助经费':'申请集团补助经费'" name="subsidyFunding">
                  {{ historyData.subsidyFunding !== null ? historyData.subsidyFunding : projectData.subsidyFunding }}万元
                </t-form-item>
                <t-form-item label="自筹经费" name="zcFunding">
                  <div v-if="historyData.adviceFunding!==null">
                    {{ (historyData.adviceFunding * 100 - historyData.subsidyFunding * 100) / 100 }}万元
                  </div>
                  <div v-else>
                    {{ (projectData.adviceFunding * 100 - projectData.subsidyFunding * 100) / 100 }}万元
                  </div>
                </t-form-item>
                <!--                <t-form-item label="大纲编制日期" >-->
                <!--                  {{data.compileDate}}-->
                <!--                </t-form-item>-->
                <!--                <t-form-item label="项目概要" >-->
                <!--                  <div v-html="data.profile">-->
                <!--                  </div>-->
                <!--                </t-form-item>-->
              </t-card>
            </t-col>
            <t-col :span="6">
              <t-card class="step-card" size="small" title="项目组情况">
                <t-form-item label="总人数" name="projectTeam.totalCount">
                  {{ historyData.projectTeam.totalCount }}
                </t-form-item>
                <t-form-item label="高级职称人数" name="projectTeam.highCount">
                  {{ historyData.projectTeam.highCount }}
                </t-form-item>
                <t-form-item label="中级职称人数" name="projectTeam.middleCount">
                  {{ historyData.projectTeam.middleCount }}
                </t-form-item>
                <t-form-item label="初级职称人数" name="projectTeam.primaryCount">
                  {{ historyData.projectTeam.primaryCount }}
                </t-form-item>
                <t-form-item label="研究生人数" name="projectTeam.postgraduate">
                  {{ historyData.projectTeam.postgraduate }}
                </t-form-item>
                <t-form-item label="辅助人员人数" name="projectTeam.auxilian">
                  {{ historyData.projectTeam.auxilian }}
                </t-form-item>
                <!--                <t-form-item label="项目概要" >-->
                <!--                  <div v-html="data.profile">-->
                <!--                  </div>-->
                <!--                </t-form-item>-->
              </t-card>
            </t-col>
          </t-row>
          <t-row style="align-items: stretch;row-gap: 12px" :gutter="14" v-if="!hideInfo">
            <t-col :span="6">
              <t-card class="step-card" size="small" title="项目负责人">
                <t-form-item label="姓名" name="projectLeader.name">
                  {{ projectData.projectLeader.name }}
                </t-form-item>
                <t-form-item label="性别" name="projectLeader.sex">
                  {{ projectData.projectLeader.sex  | filterByDict(dict.type.sys_user_sex) }}
                </t-form-item>
                <t-form-item label="出生年月" name="projectLeader.birthDate">
                  {{ projectData.projectLeader.birthDate }}
                </t-form-item>
                <t-form-item label="身份证号" name="projectLeader.idCard">
                  {{ projectData.projectLeader.idCard }}
                </t-form-item>
                <t-form-item label="工作单位" name="projectLeader.companyId">
                  {{ projectData.projectLeader.company }}
                </t-form-item>
                <!--                <t-form-item label="归口单位" name="projectLeader.companyId">-->
                <!--                  {{projectData.attributeDeptName}}-->
                <!--                </t-form-item>-->
                <t-form-item label="联系电话" name="projectLeader.phone">
                  {{ projectData.projectLeader.phone }}
                </t-form-item>
                <t-form-item label="通讯地址" name="projectLeader.address">
                  {{ projectData.projectLeader.address }}
                </t-form-item>
                <t-form-item label="电子信箱" name="projectLeader.email">
                  {{ projectData.projectLeader.email }}
                </t-form-item>
                <t-form-item label="邮编" name="projectLeader.postCode">
                  {{ projectData.projectLeader.postCode }}
                </t-form-item>
                <t-form-item label="毕业院校" name="projectLeader.school">
                  {{ projectData.projectLeader.school }}
                </t-form-item>
                <t-form-item label="学历" name="projectLeader.education">
                  {{ projectData.projectLeader.education | filterByDict(dict.type.education) }}
                </t-form-item>
                <t-form-item label="学位" name="projectLeader.degree">
                  {{ projectData.projectLeader.degree   | filterByDict(dict.type.degree) }}
                </t-form-item>
                <t-form-item label="所学专业" name="projectLeader.majorName">
                  {{ projectData.projectLeader.majorName }}
                </t-form-item>
                <t-form-item label="现从事专业" name="projectLeader.majorNowName">
                  {{ projectData.projectLeader.majorNowName }}
                </t-form-item>
                <t-form-item label="职务" name="projectLeader.duty">
                  {{ projectData.projectLeader.duty }}
                </t-form-item>
                <t-form-item label="技术职称" name="projectLeader.profTitId">
                  {{ projectData.projectLeader.profTitId | filterByTree(profTitOptions) }}
                </t-form-item>
                <t-form-item label="职称" name="projectLeader.profTit">
                  {{ projectData.projectLeader.profTit    | filterByDict(dict.type.prof_tit) }}
                </t-form-item>
                <t-form-item label="在本项目中承担的任务" name="projectLeader.task">
                  {{ projectData.projectLeader.task }}
                </t-form-item>
              </t-card>
            </t-col>
            <t-col :span="6">
              <t-card class="step-card" size="small" title="项目联系人">
                <t-form-item label="姓名" name="projectLinker.name">
                  {{ projectData.projectLinker.name }}
                </t-form-item>
                <t-form-item label="联系电话" name="projectLinker.phone">
                  {{ projectData.projectLinker.phone }}
                </t-form-item>
                <t-form-item label="通信地址" name="projectLinker.address">
                  {{ projectData.projectLinker.address }}
                </t-form-item>
                <t-form-item label="电子信箱" name="projectLinker.email">
                  {{ projectData.projectLinker.email }}
                </t-form-item>
                <t-form-item label="邮编" name="projectLinker.postCode">
                  {{ projectData.projectLinker.postCode }}
                </t-form-item>
              </t-card>
            </t-col>
          </t-row>
        </t-form>
        <t-divider style="font-size: 20px">项目概要</t-divider>
        <t-card class="step-card" size="small" title="项目概要">
          <div v-html="historyData.profile">
          </div>
        </t-card>
        <t-divider style="font-size: 20px">前期研究及工作基础</t-divider>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目前期研究及工作基础（包括国内外同类技术研究现状分析及评价，应附主要参考文献及出处）">
              <div v-html="historyData.projectOutlinePreWork.preliminaryWork"></div>
            </t-card>
          </t-col>
        </t-row>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="参考文献">
              <project-background-literature key="project-background-literature1" phaseType="2"
                                             ref="project-background-literature1" :projectId="objId"
                                             v-model="historyData.projectOutlinePreWork.literatures"
                                             :use-old-data="true" :editOpen="false"></project-background-literature>
            </t-card>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">研究、开发的背景、必要性</t-divider>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目研究、开发的背景、必要性（包括项目研究目的，市场需求前景或推广应用领域，达到的技术水平及在国民经济发展中的作用等）">
              <div v-html="historyData.projectOutlineNecessity.necessity"></div>
            </t-card>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">研究、开发实施方案</t-divider>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目研究、开发实施方案（包括拟解决的关键问题，实施的具体内容及实施方案，拟采取的技术路线等）">
              <div class="content_style" v-html="historyData.projectOutlineImplPlan.implementationPlan"></div>
            </t-card>
          </t-col>
        </t-row>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目研究开发进度（包括年度工作计划安排，项目完成期限）">
              <project-research-plan key="project-research-plan1" ref="project-research-plan1"
                                     v-model="historyData.projectOutlineImplPlan.researchPlans" :use-old-data="true"
                                     :disableDate="disableDate" :projectId="objId" :editOpen="false"
                                     phaseType="2"></project-research-plan>
            </t-card>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">考核目标和技术经济指标</t-divider>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="考核目标">
              <project-approach-expect-results key="project-approach-expect-results1"
                                               ref="project-approach-expect-results1" phaseType="2" :projectId="objId"
                                               :use-old-data="true"
                                               v-model="historyData.projectOutlineGoal.projectExpectResults"
                                               :editOpen="false"></project-approach-expect-results>
            </t-card>
          </t-col>
        </t-row>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="技术经济指标">
              <div v-html="historyData.projectOutlineGoal.goal"></div>
            </t-card>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">单位信息</t-divider>
        <t-row class="step-card" style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <project-unit key="project-unit1" ref="project-unit1" :use-old-data="true"
                          v-model="historyData.projectCompanyList" :projectId="objId"
                          :adviceFunding="historyData.adviceFunding" :editOpen="false" phaseType="2"></project-unit>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">研究人员</t-divider>
        <t-row class="step-card" style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <project-member key="project-member1" ref="project-member1" :use-old-data="true"
                            v-model="historyData.projectMemberList" :projectId="objId" :editOpen="false"
                            phaseType="2"></project-member>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">经费预算</t-divider>
        <project-budget key="project-budget1" ref="project-budget1" :use-old-data="true"
                        v-model="historyData.projectBudget" :projectId="objId" :fundingObj="historyFundingObj"
                        :editOpen="false" phaseType="2"></project-budget>
        <t-divider style="font-size: 20px">经济效益和社会效益评估</t-divider>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="经济效益和社会效益评估">
              <div v-html="historyData.projectOutlineBenefits?.economicBenefits"></div>
            </t-card>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">其他问题</t-divider>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="其它需要说明的问题（软科学类研究项目要列明预期成果报告的章节）">
              <div class="content_style" v-html="historyData.projectOutlineOther?.otherProblems"></div>
            </t-card>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">按专家评审意见修改说明</t-divider>
        <t-row v-if="projectData.isOldProject === '0'" style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="专家评审意见">
              <approve-list-by-review-type review-type="1" :obj-id="objId"></approve-list-by-review-type>
            </t-card>
          </t-col>
        </t-row>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="按专家评审意见修改说明">
              <div class="content_style" v-html="historyData.projectOutlineExplain?.content"></div>
            </t-card>
          </t-col>
        </t-row>
        <!--       <t-divider style="font-size: 20px">附件信息</t-divider>-->
        <!--       <t-row style="align-items: stretch" :gutter="14">-->
        <!--         <t-col :span="12">-->
        <!--           <t-table v-if="isMyProject" row-key="id" :columns="fileColumns" :data="fileData">-->
        <!--             <template #op="{row}">-->
        <!--               <file-upload @success="uploadSuccess"  tips="限制pdf、图片" accept="application/pdf,image/*" v-model="row.fileIds" :moduleKey="row.moduleKey"-->
        <!--                            :fileList="row.fileLists"-->
        <!--                            :multiple="true">-->
        <!--                 <t-button variant="outline">-->
        <!--                   <t-icon name="cloud-upload" slot="icon"/>-->
        <!--                   点击上传-->
        <!--                 </t-button>-->
        <!--               </file-upload>-->
        <!--             </template>-->
        <!--             <template #c1="{row}">-->
        <!--               <a v-if="row.c3" class="t-button-link" :href="`${file_domain}/${row.c3}`" target="_blank">{{ row.c1 }}</a>-->
        <!--               <div v-else>{{ row.c1 }}</div>-->
        <!--             </template>-->
        <!--           </t-table>-->
        <!--           <t-table v-else row-key="id" :columns="fileColumns" :data="fileData">-->
        <!--             <template #c1="{row}">-->
        <!--               <a v-if="row.c3" class="t-button-link" :href="`${file_domain}/${row.c3}`" target="_blank">{{ row.c1 }}</a>-->
        <!--               <div v-else>{{ row.c1 }}</div>-->
        <!--             </template>-->
        <!--             <template  #op="{row}">-->
        <!--               <a class="t-button-link" target="_blank" v-for="(item,index) in row.fileLists" :href="item.url" :key="index">-->
        <!--                 {{item.name}}-->
        <!--               </a>-->
        <!--             </template>-->
        <!--           </t-table>-->
        <!--         </t-col>-->
        <!--       </t-row>-->
      </t-col>
      <t-col :span="6">
        <t-tag size="large" variant="light" theme="primary">最新大纲</t-tag>
        <t-divider style="font-size: 20px">基本信息</t-divider>
        <t-form :colon="true" labelWidth="160px">
          <t-row style="align-items: stretch;row-gap: 12px" :gutter="14">
            <t-col :span="6">
              <t-card class="step-card" size="small" title="基本信息">
                <t-form-item label="项目编号" name="projectNum">
                  {{ projectData.projectNum || '暂未分配' }}
                </t-form-item>
                <t-form-item label="项目名称" :style="{color:data.projectName!==historyData.projectName?'red':''}"
                             name="projectName">
                  {{ data.projectName }}
                </t-form-item>
                <t-form-item label="承担单位">
                  {{ projectData.declareDeptName }}
                </t-form-item>
                <t-form-item label="计划类别" name="projectCategory">
                  {{ projectData.projectCategory | filterByTree(projectCategoryOptions) }}

                </t-form-item>
                <t-form-item label="学科分类" name="subjectClassification">
                  {{ projectData.subjectClassification | filterByDict(dict.type.subject_classification) }}
                </t-form-item>

                <t-form-item label="项目类型" name="projectType">
                  {{ projectData.projectType | filterByDict(dict.type.project_type) }}
                </t-form-item>
                <t-form-item label="申报日期" name="declareDate">
                  {{ projectData.declareDate }}
                </t-form-item>
                <t-form-item label="编制日期">
                  {{ data.compileDate }}
                </t-form-item>
                <t-form-item label="项目开始时间" :style="{color:data.startDate!==historyData.startDate?'red':''}"
                             name="startDate">
                  {{ data.startDate }}
                </t-form-item>
                <t-form-item label="项目结束时间" :style="{color:data.endDate!==historyData.endDate?'red':''}" name="endDate">
                  {{ data.endDate }}
                </t-form-item>
                <t-form-item label="关键词" name="keyWord">
                  {{ projectData.keyWord }}
                </t-form-item>
                <t-form-item label="建议经费总概算" :style="{color:data.adviceFunding!==historyData.adviceFunding?'red':''}"
                             name="adviceFunding">
                  {{ data.adviceFunding }}万元
                </t-form-item>
                <t-form-item :label="site_tag==='jtt'?'申请厅补助经费':'申请集团补助经费'"
                             :style="{color:data.subsidyFunding!==historyData.subsidyFunding?'red':''}"
                             name="subsidyFunding">
                  {{ data.subsidyFunding }}万元
                </t-form-item>
                <t-form-item
                  :style="{color:(data.adviceFunding!==historyData.adviceFunding || data.subsidyFunding!==historyData.subsidyFunding)?'red':''}"
                  label="自筹经费" name="zcFunding">
                  <div v-if="data.adviceFunding!==null">
                    {{ (data.adviceFunding * 100 - data.subsidyFunding * 100) / 100 }}万元
                  </div>
                  <div v-else>
                    {{ (projectData.adviceFunding * 100 - projectData.subsidyFunding * 100) / 100 }}万元
                  </div>
                </t-form-item>
              </t-card>
            </t-col>
            <t-col :span="6">
              <t-card class="step-card" size="small" title="项目组情况">
                <t-form-item label="总人数" name="projectTeam.totalCount"
                             :style="{color:data.projectTeam?.totalCount && historyData.projectTeam?.totalCount!==data.projectTeam?.totalCount?'red':''}">
                  {{ data.projectTeam.totalCount }}
                </t-form-item>
                <t-form-item label="高级职称人数" name="projectTeam.highCount"
                             :style="{color:data.projectTeam?.highCount && historyData.projectTeam?.highCount!==data.projectTeam?.highCount?'red':''}">
                  {{ data.projectTeam.highCount }}
                </t-form-item>
                <t-form-item label="中级职称人数" name="projectTeam.middleCount"
                             :style="{color:data.projectTeam?.middleCount && historyData.projectTeam?.middleCount!==data.projectTeam?.middleCount?'red':''}">
                  {{ data.projectTeam.middleCount }}
                </t-form-item>
                <t-form-item label="初级职称人数" name="projectTeam.primaryCount"
                             :style="{color:data.projectTeam?.primaryCount && historyData.projectTeam?.primaryCount!==data.projectTeam?.primaryCount?'red':''}">
                  {{ data.projectTeam.primaryCount }}
                </t-form-item>
                <t-form-item label="研究生人数" name="projectTeam.postgraduate"
                             :style="{color:data.projectTeam?.postgraduate && historyData.projectTeam?.postgraduate!==data.projectTeam?.postgraduate?'red':''}">
                  {{ data.projectTeam.postgraduate }}
                </t-form-item>
                <t-form-item label="辅助人员人数" name="projectTeam.auxilian"
                             :style="{color:data.projectTeam?.auxilian && historyData.projectTeam?.auxilian!==data.projectTeam?.auxilian?'red':''}">
                  {{ data.projectTeam.auxilian }}
                </t-form-item>
              </t-card>
            </t-col>
          </t-row>
          <t-row style="align-items: stretch;row-gap: 12px" :gutter="14" v-if="!hideInfo">
            <t-col :span="6">
              <t-card class="step-card" size="small" title="项目负责人">
                <t-form-item label="姓名" name="projectLeader.name">
                  {{ projectData.projectLeader.name }}
                </t-form-item>
                <t-form-item label="性别" name="projectLeader.sex">
                  {{ projectData.projectLeader.sex  | filterByDict(dict.type.sys_user_sex) }}
                </t-form-item>
                <t-form-item label="出生年月" name="projectLeader.birthDate">
                  {{ projectData.projectLeader.birthDate }}
                </t-form-item>
                <t-form-item label="身份证号" name="projectLeader.idCard">
                  {{ projectData.projectLeader.idCard }}
                </t-form-item>
                <t-form-item label="工作单位" name="projectLeader.companyId">
                  {{ projectData.projectLeader.company }}
                </t-form-item>
                <!--                <t-form-item label="归口单位" name="projectLeader.companyId">-->
                <!--                  {{projectData.attributeDeptName}}-->
                <!--                </t-form-item>-->
                <t-form-item label="联系电话" name="projectLeader.phone">
                  {{ projectData.projectLeader.phone }}
                </t-form-item>
                <t-form-item label="通讯地址" name="projectLeader.address">
                  {{ projectData.projectLeader.address }}
                </t-form-item>
                <t-form-item label="电子信箱" name="projectLeader.email">
                  {{ projectData.projectLeader.email }}
                </t-form-item>
                <t-form-item label="邮编" name="projectLeader.postCode">
                  {{ projectData.projectLeader.postCode }}
                </t-form-item>
                <t-form-item label="毕业院校" name="projectLeader.school">
                  {{ projectData.projectLeader.school }}
                </t-form-item>
                <t-form-item label="学历" name="projectLeader.education">
                  {{ projectData.projectLeader.education | filterByDict(dict.type.education) }}
                </t-form-item>
                <t-form-item label="学位" name="projectLeader.degree">
                  {{ projectData.projectLeader.degree   | filterByDict(dict.type.degree) }}
                </t-form-item>
                <t-form-item label="所学专业" name="projectLeader.majorName">
                  {{ projectData.projectLeader.majorName }}
                </t-form-item>
                <t-form-item label="现从事专业" name="projectLeader.majorNowName">
                  {{ projectData.projectLeader.majorNowName }}
                </t-form-item>
                <t-form-item label="职务" name="projectLeader.duty">
                  {{ projectData.projectLeader.duty }}
                </t-form-item>
                <t-form-item label="技术职称" name="projectLeader.profTitId">
                  {{ projectData.projectLeader.profTitId | filterByTree(profTitOptions) }}
                </t-form-item>
                <t-form-item label="职称" name="projectLeader.profTit">
                  {{ projectData.projectLeader.profTit    | filterByDict(dict.type.prof_tit) }}
                </t-form-item>
                <t-form-item label="在本项目中承担的任务" name="projectLeader.task">
                  {{ projectData.projectLeader.task }}
                </t-form-item>
              </t-card>
            </t-col>
            <t-col :span="6">
              <t-card class="step-card" size="small" title="项目联系人">
                <t-form-item label="姓名" name="projectLinker.name">
                  {{ projectData.projectLinker.name }}
                </t-form-item>
                <t-form-item label="联系电话" name="projectLinker.phone">
                  {{ projectData.projectLinker.phone }}
                </t-form-item>
                <t-form-item label="通信地址" name="projectLinker.address">
                  {{ projectData.projectLinker.address }}
                </t-form-item>
                <t-form-item label="电子信箱" name="projectLinker.email">
                  {{ projectData.projectLinker.email }}
                </t-form-item>
                <t-form-item label="邮编" name="projectLinker.postCode">
                  {{ projectData.projectLinker.postCode }}
                </t-form-item>
              </t-card>
            </t-col>
          </t-row>
        </t-form>
        <t-divider style="font-size: 20px">项目概要</t-divider>
        <t-card class="step-card" size="small" title="项目概要">
<!--          <div v-html="data.profile" :style="{color:data.profile!==historyData.profile?'red':''}">-->
<!--          </div>-->
          <div v-html="data.profile">
          </div>
        </t-card>
        <t-divider style="font-size: 20px">前期研究及工作基础</t-divider>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目前期研究及工作基础（包括国内外同类技术研究现状分析及评价，应附主要参考文献及出处）">
<!--              <div v-html="data.projectOutlinePreWork.preliminaryWork"-->
<!--                   :style="{color:data.projectOutlinePreWork.preliminaryWork!==historyData.projectOutlinePreWork.preliminaryWork?'red':''}"></div>-->
              <div v-html="data.projectOutlinePreWork.preliminaryWork"></div>
            </t-card>
          </t-col>
        </t-row>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="参考文献">
              <template #title>
                <span
                  :style="{color:data.projectOutlinePreWork.literatures.length!==historyData.projectOutlinePreWork.literatures?'red':''}">参考文献</span>
              </template>
              <project-background-literature :use-old-data="true" phaseType="2" key="project-background-literature2"
                                             ref="project-background-literature2" :projectId="objId"
                                             v-model="data.projectOutlinePreWork.literatures"
                                             :old-data="historyData.projectOutlinePreWork.literatures"
                                             :editOpen="false"></project-background-literature>
            </t-card>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">研究、开发的背景、必要性</t-divider>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目研究、开发的背景、必要性（包括项目研究目的，市场需求前景或推广应用领域，达到的技术水平及在国民经济发展中的作用等）">
<!--              <div v-html="data.projectOutlineNecessity.necessity"-->
<!--                   :style="{color:data.projectOutlineNecessity.necessity!==historyData.projectOutlineNecessity.necessity?'red':''}"></div>-->
              <div v-html="data.projectOutlineNecessity.necessity"></div>
            </t-card>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">研究、开发实施方案</t-divider>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目研究、开发实施方案（包括拟解决的关键问题，实施的具体内容及实施方案，拟采取的技术路线等）">
<!--              <div class="content_style" v-html="data.projectOutlineImplPlan.implementationPlan"-->
<!--                   :style="{color:data.projectOutlineImplPlan.implementationPlan!==historyData.projectOutlineImplPlan.implementationPlan?'red':''}"></div>-->
              <div class="content_style" v-html="data.projectOutlineImplPlan.implementationPlan"></div>
            </t-card>
          </t-col>
        </t-row>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目研究开发进度（包括年度工作计划安排，项目完成期限）">
              <project-research-plan key="project-research-plan2" :use-old-data="true" ref="project-research-plan2"
                                     v-model="data.projectOutlineImplPlan.researchPlans"
                                     :old-data="historyData.projectOutlineImplPlan.researchPlans"
                                     :disableDate="disableDate" :projectId="objId" :editOpen="false"
                                     phaseType="2"></project-research-plan>
            </t-card>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">考核目标和技术经济指标</t-divider>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="考核目标">
              <project-approach-expect-results :use-old-data="true" key="project-approach-expect-results2"
                                               ref="project-approach-expect-results2" phaseType="2" :projectId="objId"
                                               v-model="data.projectOutlineGoal.projectExpectResults"
                                               :old-data="historyData.projectOutlineGoal.projectExpectResults"
                                               :editOpen="false"></project-approach-expect-results>
            </t-card>
          </t-col>
        </t-row>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="技术经济指标">
<!--              <div v-html="data.projectOutlineGoal.goal"-->
<!--                   :style="{color:data.projectOutlineGoal.goal!==historyData.projectOutlineGoal.goal?'red':''}"></div>-->
              <div v-html="data.projectOutlineGoal.goal"></div>
            </t-card>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">单位信息</t-divider>
        <t-row class="step-card" style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <project-unit v-model="data.projectCompanyList" :use-old-data="true"  :old-data="historyData.projectCompanyList"
                          key="project-unit2" ref="project-unit2" :projectId="objId"
                          :adviceFunding="historyData.adviceFunding" :editOpen="false" phaseType="2"></project-unit>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">研究人员</t-divider>
        <t-row class="step-card" style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <project-member key="project-member2" ref="project-member2" :use-old-data="true" v-model="data.projectMemberList"
                            :old-data="historyData.projectMemberList" :projectId="objId" :editOpen="false"
                            phaseType="2"></project-member>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">经费预算</t-divider>
        <project-budget key="project-budget2" ref="project-budget2" :contrastOpen="true" :review-open="true"
                        :useBaseData="true" :use-old-data="true" :old-data="historyData.projectBudget" v-model="data.projectBudget"
                        :projectId="objId" :fundingObj="fundingObj" :editOpen="false" phaseType="2"></project-budget>
        <t-divider style="font-size: 20px">经济效益和社会效益评估</t-divider>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="经济效益和社会效益评估">
<!--              <div v-html="data.projectOutlineBenefits?.economicBenefits"-->
<!--                   :style="{color:data.projectOutlineBenefits?.economicBenefits!==historyData.projectOutlineBenefits?.economicBenefits?'red':''}"></div>-->
              <div v-html="data.projectOutlineBenefits?.economicBenefits"
                   ></div>
            </t-card>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">其他问题</t-divider>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="其它需要说明的问题（软科学类研究项目要列明预期成果报告的章节）">
<!--              <div class="content_style" v-html="data.projectOutlineOther?.otherProblems"-->
<!--                   :style="{color:data.projectOutlineOther?.otherProblems!==historyData.projectOutlineOther?.otherProblems?'red':''}"></div>-->
              <div class="content_style" v-html="data.projectOutlineOther?.otherProblems"></div>
            </t-card>
          </t-col>
        </t-row>
        <t-divider style="font-size: 20px">按专家评审意见修改说明</t-divider>
        <t-row v-if="projectData.isOldProject === '0'" style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="专家评审意见">
              <approve-list-by-review-type review-type="1" :obj-id="objId"></approve-list-by-review-type>
            </t-card>
          </t-col>
        </t-row>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="按专家评审意见修改说明">
<!--              <div class="content_style" v-html="data.projectOutlineExplain?.content"-->
<!--                   :style="{color:data.projectOutlineExplain?.content!==historyData.projectOutlineExplain?.content?'red':''}"></div>-->
              <div class="content_style" v-html="data.projectOutlineExplain?.content"></div>
            </t-card>
          </t-col>
        </t-row>
        <!--       <t-divider style="font-size: 20px">附件信息</t-divider>-->
        <!--       <t-row style="align-items: stretch" :gutter="14">-->
        <!--         <t-col :span="12">-->
        <!--           <t-table v-if="isMyProject" row-key="id" :columns="fileColumns" :data="fileData">-->
        <!--             <template #op="{row}">-->
        <!--               <file-upload @success="uploadSuccess"  tips="限制pdf、图片" accept="application/pdf,image/*" v-model="row.fileIds" :moduleKey="row.moduleKey"-->
        <!--                            :fileList="row.fileLists"-->
        <!--                            :multiple="true">-->
        <!--                 <t-button variant="outline">-->
        <!--                   <t-icon name="cloud-upload" slot="icon"/>-->
        <!--                   点击上传-->
        <!--                 </t-button>-->
        <!--               </file-upload>-->
        <!--             </template>-->
        <!--             <template #c1="{row}">-->
        <!--               <a v-if="row.c3" class="t-button-link" :href="`${file_domain}/${row.c3}`" target="_blank">{{ row.c1 }}</a>-->
        <!--               <div v-else>{{ row.c1 }}</div>-->
        <!--             </template>-->
        <!--           </t-table>-->
        <!--           <t-table v-else row-key="id" :columns="fileColumns" :data="fileData">-->
        <!--             <template #c1="{row}">-->
        <!--               <a v-if="row.c3" class="t-button-link" :href="`${file_domain}/${row.c3}`" target="_blank">{{ row.c1 }}</a>-->
        <!--               <div v-else>{{ row.c1 }}</div>-->
        <!--             </template>-->
        <!--             <template  #op="{row}">-->
        <!--               <a class="t-button-link" target="_blank" v-for="(item,index) in row.fileLists" :href="item.url" :key="index">-->
        <!--                 {{item.name}}-->
        <!--               </a>-->
        <!--             </template>-->
        <!--           </t-table>-->
        <!--         </t-col>-->
        <!--       </t-row>-->
      </t-col>
    </t-row>
  </div>
</template>

<script>
import { VITE_FILE_DOMAIN } from '@/api/upload'
import ProjectResearchPlan from '../../pm/components/project-research-plan.vue'
import ProjectMember from '../../pm/components/project-member.vue'
import ProjectUnit from '../../pm/components/project-unit.vue'
import ProjectBudget from '../../pm/components/project-budget.vue'
import ProjectApproachExpectResults from "../../pm/components/project-approach-expectResults.vue";
import ProjectBackgroundLiterature from "../../pm/components/project-background-literature.vue";
import dayjs from "dayjs";
import FileUpload from "@/components/FileUpload/index.vue"
import approveListByReviewType from "../../approve/components/approve-list-by-review-type.vue";
import diff,{useHighlightCurrentDetail} from "@/utils/diff";

export default {
  name: "vertical-outline-detail",
  dicts: ["project_type", "subject_classification", "sys_user_sex", "prof_tit", "degree", "duty", "platform_type", "member_type", "education", "recommend_type"],
  components: {
    ProjectResearchPlan,
    ProjectMember,
    ProjectBudget,
    ProjectApproachExpectResults,
    ProjectUnit,
    FileUpload,
    ProjectBackgroundLiterature,
    approveListByReviewType
  },
  props: {
    objId: [String, Number],
    outlineId: [String, Number],
    // header: String,
    isDialog: {
      type: Boolean,
      default: true
    },
    hideInfo: {
      type: Boolean,
      default: false
    },
    hideByProjectType: {
      type: Boolean,
      default: false
    },
    size: {
      type: String,
      default: 'large'
    },
    reviewOpen: {
      type: Boolean,
      default: false
    },
    contrastOpen: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      historyData: {
        project: {},
        projectResearchPlans: [],
        projectTeam: {},
        projectOutlinePreWork: {},
        projectOutlineNecessity: {},
        projectOutlineImplPlan: {},
        projectCompanyList: [],
        projectBudget: {},
        projectOutlineOther: {},
        projectMemberList: [],
        projectOutlineExplain: {},
        projectOutlineGoal: {},
        projectOutlineBenefits:{}
      },
      header: '',
      site_tag: import.meta.env.VITE_SITE_TAG,
      file_domain: VITE_FILE_DOMAIN,
      isMyProject: false,
      fileColumns: [
        {
          colKey: "id",
          title: "序号",
          align: "center",
          width: 64
        },
        {
          colKey: "c1",
          title: "附件名称",
          align: "center",
        },

        {
          colKey: "c2",
          title: "是否必需",
          align: "center",
        },
        {
          colKey: "op",
          title: "附件列表",
          align: "left",
        },
      ],
      fileData: [
        {
          id: 1,
          c1: "已盖章大纲",
          c2: "审批通过之后，走完盖章流程后上传。",
          fileIds: [],
          fileLists: [],
          moduleKey: "projectDG"
        }
      ],
      fundingObj: {subsidyFunding: 0, adviceFunding: 0},
      historyFundingObj: {subsidyFunding: 0, adviceFunding: 0},
      disableDate: {},
      profTitOptions: [],
      projectData: {
        projectCategory: '',
        projectTeam: {},
        projectLeader: {},
        projectLinker: {},
        projectBackground: {
          background: ''
        },
        projectApproach: {
          projectExpectResults: []
        },
        projectBasicstudy: {},
        projectCompanyList: [],
        projectMemberList: [],
        projectBudget: {}
      },
      projectCategoryOptions: [],
      visible: true,
      tabValue: "1",
      data: {
        project: {},
        projectResearchPlans: [],
        projectTeam: {},
        projectOutlinePreWork: {},
        projectOutlineNecessity: {},
        projectOutlineImplPlan: {},
        projectCompanyList: [],
        projectBudget: {},
        projectOutlineOther: {},
        projectMemberList: [],
        projectOutlineExplain: {},
        projectOutlineGoal: {},
        projectOutlineBenefits:{},
      },
    }
  },
  watch: {
    objId: {
      immediate: true,
      handler(val) {
        if (val) {
          this.getObj(val);
        }
      }
    },
  },
  mounted() {
    // setTimeout(()=>{
    //   console.log(this.historyData.profile,'1', this.data.profile)
    //   const diffResults = diff.diffText(this.historyData.profile || '', this.data.profile || '');
    //   // console.log(diffResults, '111111')
    //   const data = useHighlightCurrentDetail(diffResults)
    //   console.log(data, 'niamde')
    // },5000)
  },
  methods: {
    async getObj() {
      await Promise.all([this.getDeclareTree(), this.getprofTitTreeSelect()]);
      this.$api.kjxm.project.get(this.objId).then(pro => {
        if (pro.data.createUserId === Number(this.$store.state.user.userId)) {
          this.isMyProject = true;
        }
        this.projectData = pro.data;
        // 根据当前项目限定时间
        this.disableDate = {
          before: dayjs(pro.data.startDate, "YYYY-MM-DD").endOf('month').subtract(1, 'month').format(),
          after: dayjs(pro.data.endDate, "YYYY-MM-DD").endOf('month').subtract(0, 'month').format(),
        }
          Promise.all([this.$api.kjxm.outline.getAllHistory(this.objId),this.$api.kjxm.outline.getAll(this.objId)]).then(res => {
              if (res[0].data) {
                this.historyData = res[0].data;
                this.historyFundingObj = {
                  adviceFunding: res[0].data.adviceFunding,
                  subsidyFunding: res[0].data.subsidyFunding
                }
              }
              this.data = res[1].data;
              this.fundingObj = {
                adviceFunding: res[1].data.adviceFunding,
                subsidyFunding: res[1].data.subsidyFunding
              }

              this.data.profile = useHighlightCurrentDetail(diff.diffText(this.data.profile || '',this.historyData.profile || ''));
              this.data.projectOutlinePreWork.preliminaryWork = useHighlightCurrentDetail(diff.diffText(this.data.projectOutlinePreWork.preliminaryWork || '',this.historyData.projectOutlinePreWork.preliminaryWork || ''));
              this.data.projectOutlineNecessity.necessity = useHighlightCurrentDetail(diff.diffText(this.data.projectOutlineNecessity.necessity || '',this.historyData.projectOutlineNecessity.necessity || ''));
              this.data.projectOutlineImplPlan.implementationPlan = useHighlightCurrentDetail(diff.diffText(this.data.projectOutlineImplPlan.implementationPlan || '',this.historyData.projectOutlineImplPlan.implementationPlan || ''));
              this.data.projectOutlineGoal.goal = useHighlightCurrentDetail(diff.diffText(this.data.projectOutlineGoal.goal || '',this.historyData.projectOutlineGoal.goal || ''));
              this.data.projectOutlineBenefits.economicBenefits = useHighlightCurrentDetail(diff.diffText(this.data.projectOutlineBenefits.economicBenefits || '',this.historyData.projectOutlineBenefits.economicBenefits || ''));
              this.data.projectOutlineOther.otherProblems = useHighlightCurrentDetail(diff.diffText(this.data.projectOutlineOther.otherProblems || '',this.historyData.projectOutlineOther.otherProblems || ''));
              this.data.projectOutlineExplain.content = useHighlightCurrentDetail(diff.diffText(this.data.projectOutlineExplain.content || '',this.historyData.projectOutlineExplain.content || ''));

          }).catch(e => {
            this.$message.error(e.toString())
          })
        // // 获取历史的大纲信息
        // this.$api.kjxm.outline.getAllHistory(this.objId).then(response => {
        //   if (response.data) {
        //     this.historyData = response.data;
        //     this.historyFundingObj = {
        //       adviceFunding: response.data.adviceFunding,
        //       subsidyFunding: response.data.subsidyFunding
        //     }
        //   }
        //   // this.adviceFunding = response.data.adviceFunding;
        //   // this.subsidyFunding = response.data.subsidyFunding;
        // }).catch((e) => {
        //   this.$message.error(e.toString());
        // });
        // // 获取当前的大纲信息
        // this.$api.kjxm.outline.getAll(this.objId).then(response => {
        //   this.data = response.data;
        //   this.fundingObj = {
        //     adviceFunding: response.data.adviceFunding,
        //     subsidyFunding: response.data.subsidyFunding
        //   }
        //   // this.adviceFunding = response.data.adviceFunding;
        //   // this.subsidyFunding = response.data.subsidyFunding;
        // }).catch((e) => {
        //   this.$message.error(e.toString());
        // });

      }).catch((e) => {
        this.$message.error(e.toString());
      });

    },
    getprofTitTreeSelect() {
      return this.$api.system.profTit.treeselect().then(response => {
        this.profTitOptions = response.data;
        // this.profTitOptions = this.handleTree(response.data, "id");
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    getDeclareTree() {
      return this.$api.kjxm.project.planCategoryTree().then(response => {
        this.projectCategoryOptions = response.data;
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    uploadSuccess(ids) {
      this.$api.kjxm.project.edit({
        id: this.objId,
        sysAttMainVo: {
          sysAttMainIds: ids,
        }
      }).then(val => {
        this.$message.success("上传成功");
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
  }
}
</script>

<style lang="less" scoped>
/deep/ .t-form__item {
  margin-bottom: 6px
}

.t-row {
  margin-bottom: 14px;
}

.exception-data {
  color: red;
  height: 100%;
  display: flex;
  align-items: center
}

.step-card {
  //height: 100%;
  height: 800px;
  overflow: scroll;
  margin-bottom: 14px;
}
</style>
